package day1106.Company;

import java.util.Objects;

//员工有姓名，年龄，性别，职务，薪水、工号等属性
public class Staff {
    private String name;
    private int age;
    private String sex;
    private String post;
    private double salary;
    private String num;

    public Staff(String name, int age, String sex, String post, double salary, String num) {
        this.name = name;
        this.age = age;
        this.sex = sex;
        this.post = post;
        this.salary = salary;
        this.num = num;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getPost() {
        return post;
    }

    public void setPost(String post) {
        this.post = post;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    public String getNum() {
        return num;
    }

    public void setNum(String num) {
        this.num = num;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Staff staff = (Staff) o;
        return Objects.equals(num, staff.num);
    }

    @Override
    public int hashCode() {
        return Objects.hash(num);
    }

    @Override
    public String toString() {
        return "Staff{" +
                "姓名是：'" + name + '\'' +
                ", 年龄是：" + age +
                ", 性别是：'" + sex + '\'' +
                ", 职务是：'" + post + '\'' +
                ", 工资是：" + salary +
                ", 工号是：'" + num + '\'' +
                '}';
    }
}
